﻿/// <reference path="../Jquery/jquery-1.5.2.min.js" />
(function ($) {
    $.fn.accordion = function (options) {

        var settings = $.extend({
            current: 0,
            height: 100
        }, options || {});

        var current = this;
        $(".accordion-button", this).live("click", function () {

            // masque les pannels et supprime la class en cour
            $(current).children(".accordion-pannel")
                .removeClass("accordion-current")
                .children(".accordion-pannel-body")
                .css("height", 0);

            // agrandi celui demandé et ajoute la class en cour
            $(this).parent()
                .parent()
                    .addClass("accordion-current")
                    .children(".accordion-pannel-body")
                        .css("height", settings.height)
                        .addClass("accordion-current");
        });

        return this;
    };
})(jQuery);